<?php
// -----------------------------------------------------------------------------

include '../QQTranslator.php';
include 'config/config.php';

// -----------------------------------------------------------------------------

if (!isset($_GET['sourceText'])) {
    echo "需要传入有效的参数";
    exit;
}

// -----------------------------------------------------------------------------

$qqtr = new QQTranslator();
$qqtr->setSecretId($secretID);
$qqtr->setSecretKey($secretKey);
$qqtr->setProjectId($projectID);

// -----------------------------------------------------------------------------

$str = htmlspecialchars($_GET['sourceText']);
$str = urldecode($str);

echo "【汉】：" . $qqtr->translateString($str);
echo "<br />";
echo "【法】：" . $qqtr->translateString($str, "fr");
